<?php $this->load->view('header') ?>

<!-- CONTENT -->
<div id="content">
<div class="column full">
		
		<div class="box">
		<div class="box-header">Rekam Medis Pasien</div>
		<div class="box-content">
        <?php if( get_data($uri,'from') == 'paymentToday' ):?>
			<?php echo anchor('klinik/payment/today', '<span class="icon_text preview"></span>Daftar Pembayaran', 'class="button white"');?>	
		<?php else:?>
			<?php echo anchor('klinik/'.get_data($uri,'from').'/view', '<span class="icon_text preview"></span>Daftar Pasien', 'class="button white"');?>
		<?php endif;?>
		
        <?php if ((isset($isSuccess) && $isSuccess)) : ?>
        	<?php echo anchor('klinik/registrasi/proses/from/'.get_data($uri,'from').'/id/'.get_data($uri,'id'), '<span class="icon_text edit"></span>Lihat RM Kembali', 'class="button white"');?>
        <?php endif;?>
        <br /><br />    
        
            <?php if (isset($errorMessage)) : ?>
            	<div class="notification <?php echo ((isset($isSuccess) && $isSuccess) ? 'success' : 'error');?>"><?php echo $errorMessage; ?></div>
	        <?php endif; ?>    	
	        
	        <?php if (!(isset($isSuccess) && $isSuccess)) : ?>  
	        <?php  echo form_open('klinik/registrasi/proses/from/'.get_data($uri,'from').'/id/'.get_data($uri,'id').'/time/' . time(),array('name'=>'formProses','id'=>'formProses','class'=>'frModalLoad'),array('kirim'=>'kirim')); ?>
			
            <!-- Data Pasien -->
            <table>
            	<tr>
                    <td width="150"><h3><b>Data Pasien</b></h3></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                    <td><br />Tanggal Daftar</td>
                    <td>
                    	<br /><b><?php echo mydatetimeindo( get_data($dataPasien,'rmTglMulai') );?></b>
                    </td>
                </tr>
                <tr>
                    <td><br />Kode RJ</td>
                    <td>
                    	<br /><b><?php echo get_data($dataPasien,'rmKode');?></b>
                    </td>
                </tr>
                <tr>
                    <td><br />Nama</td>
                    <td>
                        <br /><b><?php echo get_data($dataPasien,'pasienNama');?></b>
                    </td>
                </tr>
                <tr>
                    <td><br />Jenkel</td>
                    <td>
                        <br /><b><?php echo get_data($dataPasien,'pasienJenKel');?></b>
                    </td>
                </tr>
                <tr>
                    <td><br />Usia</td>
                    <td>
                        <br /><b><?php echo getUsia( get_data($dataPasien,'pasienTglLahir'));?></b>
                    </td>
                </tr>
                <?php if(get_data($dataPasien,'rmTotalBiaya')):?>
                <tr>
                    <td><br />Total Biaya</td>
                    <td>
                        <br /><b>Rp. <?php echo number_format( get_data($dataPasien,'rmTotalBiaya') );?></b>
                    </td>
                </tr>
                
	                <?php /* if(get_data($dataPasien,'rmStatus') != 'Selesai'):?>
	                <tr>
	                    <td><br /></td>
	                    <td>
	                        <br />
							<?php echo anchor('klinik/registrasi/proses/from/'.get_data($uri,'from').'/action/status/id/'.$dataPasien['rmId'], '<span class="icon_text accept"></span>Set Selesai', 'class="button white"', 'class="button white"');?>
	                    </td>
	                </tr>
	                <?php endif; */?>
	                
                <?php endif;?>
            </table>
            <br /><br /><br />
            
            <!-- Data RM Detail -->
            <table>
            	<tr>
                    <td width="150"><h3><b>Detail Pemeriksaan</b></h3></td>
                    <td>&nbsp;</td>
                </tr>
                <tr>
                	<td><br />Dokter</td>
                    <td>
                    	<br />
                    	<?php $dokterId = get_data($_POST,'dokterId') ? get_data($_POST,'dokterId') : get_data($dataPasien,'dokterId')?>
                    	
	                	<select name='dokterId'>
		                	<option value=''>Pilih Dokter</option>
	                		<?php if($listDokter) foreach($listDokter as $dokter):?>
	                			<option value='<?php echo get_data($dokter,'dokterId')?>' <?php echo $dokterId == get_data($dokter,'dokterId') ? 'selected="selected"' : ''?>>
	                				<?php echo get_data($dokter,'dokterNama')?>
	                			</option>
	                		<?php endforeach;?>
	                	</select>
                	</td>
                </tr>
                <tr>
                    <td valign='top'><br />Keluhan / Gejala</td>
                    <td>
                        <br /><?php echo form_textarea(array('name'=>'rmKeluhan','value'=>get_data($_POST,'rmKeluhan') ? get_data($_POST,'rmKeluhan') : get_data($dataPasien,'rmKeluhan'),'class'=>'form-field full'));?>
                    </td>
                </tr>
                <tr>
                    <td valign='top'><br />Diagnosa</td>
                    <td>
                        <br /><?php echo form_textarea(array('name'=>'rmDiagnosa','value'=>get_data($_POST,'rmDiagnosa') ? get_data($_POST,'rmDiagnosa') : get_data($dataPasien,'rmDiagnosa'),'class'=>'form-field full'));?>
                    </td>
                </tr>
                <tr>
                    <td valign='top'><br />Keterangan</td>
                    <td>
                        <br /><?php echo form_textarea(array('name'=>'rmKeterangan','value'=>get_data($_POST,'rmKeterangan') ? get_data($_POST,'rmKeterangan') : get_data($dataPasien,'rmKeterangan'),'class'=>'form-field full'));?>
                    </td>
                </tr>
            </table>
            <br /><br />
            
            <!-- Data RM Alat -->
            <table>
            	<tr>
                    <td width="300"><h3><b>Alat</b></h3></td>
                    <td>&nbsp;</td>
                </tr>
                <?php $dataAlat = isset($_POST['alat']) ? $_POST['alat'] : $rmAlat;?>
                <?php if($listAlat) foreach($listAlat as $key1=>$alat):?>
                	<tr>
                		<td><br /><?php echo get_data($alat,'alatNama')?></td>
                		<td>
                			<br />
                			<input type='checkbox' name='alat[]' value='<?php echo get_data($alat,'alatId')?>' <?php echo in_array($alat['alatId'],$dataAlat) ? 'checked="checked"' : ''?> >
                			&nbsp;&nbsp;
                			<b>Rp. <?php echo number_format(get_data($alat,'alatHargaJual'));?></b>
                		</td>
                	</tr>
                <?php endforeach;?>
            </table>
            <br /><br />
            
            <!-- Data RM Pemeriksaan -->
            <table>
            	<tr>
                    <td width="300"><h3><b>Pemeriksaan </b></h3></td>
                    <td>&nbsp;</td>
                </tr>
                <?php $dataPemeriksaan = isset($_POST['pemeriksaan']) ? $_POST['pemeriksaan'] : $rmPemeriksaan;?>
                <?php if($listPemeriksaan) foreach($listPemeriksaan as $pemeriksaan):?>
                	<tr>
                		<td><br /><?php echo get_data($pemeriksaan,'pemeriksaanNama')?></td>
                		<td>
                			<br />
                			<input type='checkbox' name='pemeriksaan[]' value='<?php echo get_data($pemeriksaan,'pemeriksaanId')?>' <?php echo in_array($pemeriksaan['pemeriksaanId'],$dataPemeriksaan) ? 'checked="checked"' : ''?> >
                			&nbsp;&nbsp;
                			<b>Rp. <?php echo number_format(get_data($pemeriksaan,'pemeriksaanHarga'));?></b>
                		</td>
                	</tr>
                <?php endforeach;?>
            </table>
            <br /><br /><br />
            
            <table>
            	<tr>
                    <td width="300">&nbsp;</td>
                    <td>
                        <?php echo form_submit('submit','Proses', 'class="button themed"');?>
                    </td>
                </tr>
            </table>
            
            </form>
            <br />
			<?php endif;?>
			
          </div>
        </div>
      </div>
      <!-- End Widget-->
      
      <div class="clear"></div>
    </div>
  </div>
  
<script type="text/javascript">
<!--
jQuery(document).ready(function($){
	//Date
	$('#date').datepicker({
	   yearRange: "-90:+10",
	   dateFormat: 'yy-mm-dd',
	   maxDate: 'd', 
	   showButtonPanel: true,
	   changeMonth: true,
	   changeYear: true
	});
});
//-->
</script>  
<?php $this->load->view('footer') ?>